import Vue from 'vue'
import Router from 'vue-router'
import LayOut from '@/components/common/LayOut'
import AppMain from '@/components/common/AppMain'
Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [{
      path: '/',
      hidden:true,//不在导航列表中显示
      component: LayOut,
      redirect: '/menu1', //当路由未匹配时重定向，可作初始化显示页面设置
    },
    {
      path: '/menu1',
      component: LayOut,
      name: 'menu1',
      leafThree:true,//有三级路由
      meta: {
        title: 'menu1',
        icon: 'fa fa-paper-plane'
      },
      children: [
            {
                path: '/menu1-1',
                name: 'menu1-1',
                meta: {
                    title: 'menu1-1',
                    icon: 'fa fa-paper-plane'
                },
                component:AppMain,
                leaf:true,//有二级路由
                children:[
                    {
                        path: '/menu1-1-1',
                        name: 'menu1-1-1',
                        meta: {
                            title: 'menu1-1-1',
                            icon: 'fa fa-paper-plane'
                        },
                        component: resolve => require(['@/components/viewers/menu1/menu1-1-1.vue'], resolve),
                    },
                    {
                        path: '/menu1-1-2',
                        name: 'menu1-1-2',
                        meta: {
                            title: 'menu1-1-2',
                            icon: 'fa fa-paper-plane'
                        },
                        component: resolve => require(['@/components/viewers/menu1/menu1-1-2.vue'], resolve),
                    },
                ]
            },
            {
                path: '/menu1-2',
                name: 'menu1-2',
                meta: {
                    title: 'menu1-2',
                    icon: 'fa fa-paper-plane'
                },
                component: resolve => require(['@/components/viewers/menu1/menu1-2.vue'], resolve),
            },
        ]
    },
    {
        path: '/menu2',
        component: LayOut,
        name: 'menu2',
        leaf:true,//有二级路由
        meta: {
          title: 'menu2',
          icon: 'fa fa-paper-plane'
        },
        children: [
              {
                  path: '/menu2-1',
                  name: 'menu2-1',
                  meta: {
                      title: 'menu2-1',
                      icon: 'fa fa-paper-plane'
                  },
                  component: resolve => require(['@/components/viewers/menu2/menu2-1.vue'], resolve),
              },
              {
                  path: '/menu2-2',
                  name: 'menu2-2',
                  meta: {
                      title: 'menu2-2',
                      icon: 'fa fa-paper-plane'
                  },
                  component: resolve => require(['@/components/viewers/menu2/menu2-2.vue'], resolve),
              },
        ]
    },
    {
        path: '/menu3',
        component: LayOut,
        name: 'menu3',
        redirect:'/menu3-1',
        meta: {
          title: 'menu3',
          icon: 'fa fa-paper-plane'
        },
        children: [
              {
                  path: '/menu3-1',
                  name: 'menu3-1',
                  meta: {
                      title: 'menu3-1',
                      icon: 'fa fa-paper-plane'
                  },
                  component: resolve => require(['@/components/viewers/menu3/menu3-1.vue'], resolve),
              },
        ]
    },
  ]
})

